package gold.digger;

import gold.utils.InputUtil;

/**
 * Created by fanzhenyu02 on 2021/12/10.
 * common problem solver template.
 */
public class LC1217 {
    public long startExecuteTime = System.currentTimeMillis();


    class Solution {
        public int minCostToMoveChips(int[] position) {
            int oddCnt = 0, evenCnt = 0;
            for (int i : position) {
                if (i % 2 == 0) evenCnt++;
                else oddCnt++;
            }

            return Math.min(oddCnt, evenCnt);
        }
    }

    public void run() {
        System.out.println(new Solution().minCostToMoveChips(InputUtil.toIntegerArray("[1,2,3]")));
        System.out.println(new Solution().minCostToMoveChips(InputUtil.toIntegerArray("[2,2,2,3,3]")));
        System.out.println(new Solution().minCostToMoveChips(InputUtil.toIntegerArray("[1,1000000000]")));
    }

    public static void main(String[] args) throws Exception {
        LC1217 an = new LC1217();
        an.run();

        System.out.println("\ncurrent solution total execute time: " + (System.currentTimeMillis() - an.startExecuteTime) + " ms.");
    }
}
